<template>
  <div>
    <div class="tztop">
      <div class="button">
        <span
          class="iconfont icon-zuoyoujiantou"
          @click="$router.push('/recommend')"
        ></span>
        我的通知
      </div>
    </div>

    <van-tabs v-model="active">
      <van-tab title="通知">
        <div class="sxbox" v-for="(item, index) in notelist" :key="index">
          <div
            class="sximg"
            :style="'background-image: url(' +  + ')'"
          ></div>
          <p class="sxname">
            {{  }}
            <span
              class="sxicon"
              :style="
                'background-image: url(' +
                +
                ')'
              "
            ></span>
            <!-- <img class="sxicon" :src="item.fromUser.avatarDetail.identityIconUrl"> -->
          </p>
          <p class="sxtext">{{  }}</p>
        </div>
      </van-tab>

      <van-tab title="私信">
        <div class="sxbox" v-for="(item, index) in msglist" :key="index">
          <div
            class="sximg"
            :style="'background-image: url(' + item.fromUser.avatarUrl + ')'"
          ></div>
          <p class="sxname">
            {{ item.fromUser.nickname }}
            <span
              class="sxicon"
              :style="
                'background-image: url(' +
                item.fromUser.avatarDetail.identityIconUrl +
                ')'
              "
            ></span>
            <!-- <img class="sxicon" :src="item.fromUser.avatarDetail.identityIconUrl"> -->
          </p>
          <p class="sxtext">{{ item.lastMsg }}</p>
        </div>
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
//getMsgHistory
import { getMsgPrivate,getMsgNotices } from "../api/base";
export default {
  data() {
    return {
      active: 2,
      msglist: [],
      notelist:[],
      //   userid:"",
    };
  },
  methods: {
    getMsgPrivateFun() {
      getMsgPrivate().then((data) => {
        console.log(data.msgs);
        this.msglist = data.msgs;
        //   this.userid = data.msgs.fromUser.userId
      });
    },
    getMsgNoticesFun(){
        getMsgNotices().then(data=>{
            console.log(data.notices);
            this.notelist = data.notices
        })
    }
    //私信内容
    //   getMsgHistoryFun(){
    //     //   this.userid = window.localStorage.getItem("uid");
    //       getMsgHistory({uid:this.userid}).then(data=>{
    //           console.log(data);
    //       })
    //   },
  },
  created() {
    this.getMsgPrivateFun();
    this.getMsgNoticesFun();
    //   this.getMsgHistoryFun();
  },
};
</script>

<style lang="less">
.tztop {
  height: 50px;
  position: relative;
  background-color: #d4473c;
  .button {
    font-size: 18px;
    position: absolute;
    left: 12px;
    top: 12px;
    color: #fff;
  }
}
.sxbox {
//   border: 1px solid black;
border-bottom: 1px solid #e6e6e6;
  margin: 10px 10px;
  position: relative;
  height: 103px;
  .sximg {
    width: 100px;
    height: 100px;
    // border: 1px solid black;
    background-size: cover;
  }
  .sxname {
    position: absolute;
    margin-left: 110px;
    margin-top: -90px;
    font-size: 15px;
    font-weight: bold;
    .sxicon {
      position: absolute;
      margin-left: 5px;
      margin-top: 2px;
      width: 15px;
      height: 15px;
      background-size: cover;
    }
  }
  .sxtext {
    position: absolute;
    margin-left: 110px;
    margin-top: -70px;
    font-size: 13px;
    width: 180px;
    height: 35px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: wrap;
    color: #9a9a9a;
    line-height: 28px;
  }
}
</style>